/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "Rooms", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Rooms.findAll", query = "SELECT r FROM Rooms r"),
    @NamedQuery(name = "Rooms.findByRoomID", query = "SELECT r FROM Rooms r WHERE r.roomID = :roomID"),
    @NamedQuery(name = "Rooms.findByRoomName", query = "SELECT r FROM Rooms r WHERE r.roomName = :roomName"),
    @NamedQuery(name = "Rooms.findByDescription", query = "SELECT r FROM Rooms r WHERE r.description = :description"),
    @NamedQuery(name = "Rooms.findByPicture", query = "SELECT r FROM Rooms r WHERE r.picture = :picture")})
public class Rooms implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "RoomID", nullable = false)
    private Integer roomID;
    @Basic(optional = false)
    @Column(name = "RoomName", nullable = false, length = 50)
    private String roomName;
    @Basic(optional = false)
    @Column(name = "Description", nullable = false, length = 1000)
    private String description;
    @Column(name = "Picture", length = 1000)
    private String picture;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rooms")
    private List<BookRooms> bookRoomsList;
    @JoinColumn(name = "ResID", referencedColumnName = "ResID", nullable = false)
    @ManyToOne(optional = false)
    private Restaurants restaurants;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "rooms")
    private List<BookRoomDetails> bookRoomDetailsList;

    public Rooms() {
    }

    public Rooms(Integer roomID) {
        this.roomID = roomID;
    }

    public Rooms(String roomName, String description, String picture) {
        this.roomName=roomName;
        this.description=description;
        this.picture=picture;
    }

    public Integer getRoomID() {
        return roomID;
    }

    public void setRoomID(Integer roomID) {
        this.roomID = roomID;
    }

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public List<BookRooms> getBookRoomsList() {
        return bookRoomsList;
    }

    public void setBookRoomsList(List<BookRooms> bookRoomsList) {
        this.bookRoomsList = bookRoomsList;
    }

    public Restaurants getRestaurants() {
        return restaurants;
    }

    public void setRestaurants(Restaurants restaurants) {
        this.restaurants = restaurants;
    }

    public List<BookRoomDetails> getBookRoomDetailsList() {
        return bookRoomDetailsList;
    }

    public void setBookRoomDetailsList(List<BookRoomDetails> bookRoomDetailsList) {
        this.bookRoomDetailsList = bookRoomDetailsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (roomID != null ? roomID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rooms)) {
            return false;
        }
        Rooms other = (Rooms) object;
        if ((this.roomID == null && other.roomID != null) || (this.roomID != null && !this.roomID.equals(other.roomID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Rooms[roomID=" + roomID + "]";
    }

}
